<template>
  <el-dialog
      title="提示"
      v-el-drag-dialog
      v-if="showDom"
      :visible.sync="visible"
      width="720px"
      center
      :show-close="false"
      @closed="closed">
    <el-table
        class="yt-table"
        :data="lists"
        border
        style="width: 100%"
        :row-class-name="rowClassName">
      <el-table-column prop="msg" label="消息" min-width="100px"></el-table-column>
    </el-table>
    <div slot="footer" class="dialog-footer">
      <el-button size="small" type="" @click="closeTap">关 闭</el-button>
      <el-button size="small" type="primary" @click="confirmTap">一键检测</el-button>
    </div>
  </el-dialog>
</template>

<script>

export default {
  props: {},
  data() {
    return {
      type:'',
      showDom: false,
      visible: false,
      lists: []
    };
  },
  computed: {},
  mounted() {

  },
  created() {

  },
  methods: {
    show(data) {
      this.showDom = true
      this.visible = true
      this.lists = data
    },
    hide() {
      this.visible = false
    },
    closed() {
      this.showDom = false
    },
    rowClassName({row, rowIndex}) {
      if (row.code === 0) {
        return 'text-color-blue'
      } else {
        return 'text-color-red'
      }
    },
    closeTap(){
      this.hide()
      this.$emit('closeTap')
    },
    confirmTap() {
      this.hide()
      this.$emit('test', this.lists[0].data.id)
      // this.$router.push({name:'CompList'})
    }
  }
};
</script>
<style lang="less" scoped>
  @red: #ff5757;
  @yellow: yellow;
  @orange: #f7903d;
  @blue: #2aef8a;
  @gray: gray;
  .form-box-group {
    max-height: 500px;
    overflow: hidden;
    overflow-y: auto;
  }

  .form-box-item {
    padding: 15px 50px 15px 15px;
    border-bottom: solid 1px #ffffff;

    &:last-child {
      border-bottom: none;
    }
  }

  /deep/ .el-table {
    .text-color-red {
      .cell {
        color: @red !important;
      }
    }

    .text-color-orange {
      .cell {
        color: @orange !important;
      }
    }

    .text-color-yellow {
      .cell {
        color: @yellow !important;
      }
    }

    .text-color-blue {
      .cell {
        color: @blue !important;
      }
    }
  }
</style>